package com.github.zhp;

import com.github.zhp.startup.ConfigJson;

/**
 * 存放SelfConfigJson
 *
 * @author zhoup
 */
public class ConfigContext {
    private final static Object lock = new Object();
    private static ConfigJson configJson;

    public static ConfigJson getSelfConfigJson() {
        synchronized (lock) {
            if (configJson == null) {
                throw new IllegalArgumentException("SelfConfigJson未存放到SelfConfigContext中");
            }
            return configJson;
        }
    }

    public static void setSelfConfigJson(ConfigJson configJson) {
        synchronized (lock) {
            ConfigContext.configJson = configJson;
        }
    }
}
